package com.generator;
 
import java.io.File;
import java.util.List;

import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

import cn.hutool.core.util.StrUtil;

@Mojo( name = "all")
public class GeneratorAll extends AbstractMojo
{
	@Parameter( defaultValue = "${project.resources}", property = "resources", required = true )
    private List<Resource> resources;
	
	@Parameter( defaultValue = "${project.build.outputDirectory}", property = "outputDirectory", required = true )
    private File outputDirectory;
	
	@Parameter(name ="package" , defaultValue = "com.feng.zhihao.demoweb")
	private String packagePath;

	@Parameter(name ="package_json" , defaultValue = "")
	private String package_json;

	@Parameter(name ="package_service_impl" , defaultValue = "")
	private String package_service_impl;
	
	@Parameter(name ="entityNames" , required=true)
	private String entityNames;
	
    public void execute() throws MojoExecutionException{
    	if(StrUtil.isEmpty(package_json)) {
    		package_json = packagePath +".web.json";
    	}
    	if(StrUtil.isEmpty(package_service_impl)) {
    		package_service_impl = packagePath +".service.impl";
    	}
    }
}